<?php
/**
 * TomatoCMS
 *
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 *
 * @copyright    Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license        http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version     $Id: login.phtml 4185 2010-08-01 16:31:02Z huuphuoc $
 * @since        2.0.0
 */
?>
<?php
$this->headTitle($this->translator('auth_login_page_title'));
$this->headScript()->appendFile($this->APP_STATIC_SERVER . '/js/jquery.validate/jquery.validate.min.js');
?>
<form action="<?php echo $this->url(array(), 'bizprofile_auth_login'); ?>" method="post" id="loginForm" class="t_a_login_form">
<div class="t_bizprofile_auth">
    <h2><?php echo $this->translator('auth_login_page_title'); ?></h2>
	
		
    <div class="clearfix">
		<?php echo $this->flashMessenger(); ?>		
    </div>

    <div class="clearfix">
        <label><?php echo $this->translator('auth_login_user_name'); ?>:</label>
        <input type="text" name="username" id="username" value="<?php if($this->invalidLink == 2) echo $this->encodedLink['forgot_user_name']?>"/>
    </div>

    <div class="clearfix">
        <label><?php echo $this->translator('auth_login_password'); ?>:</label>
        <input type="password" name="password" value="<?php if($this->invalidLink == 2) echo $this->encodedLink['forgot_password']?>"/>
    </div>
	<?php if($this->invalidLink == 2):?>
		<input type="hidden" name="forward_changepass" value="1">
	<?php endif;?>
    <?php if($this->captchaId != null) : ?>
    <div class="clearfix">
        <label>&nbsp;</label>
        <img src="<?php echo $this->APP_STATIC_SERVER ?>/images/captcha/<?php echo $this->captchaId ?>.png" alt="Captcha code" /><br>
    </div>
    <div class="clearfix">
        <label><?php echo $this->translator('auth_login_captcha'); ?></label>
        <input name="captcha[input]" type="text" />
        <input name="captcha[id]" type="hidden" value="<?php echo $this->captchaId ?>" />
    </div>
    <?php endif; ?>

    <div class="clearfix">
        <label>&nbsp;</label>
        <a href="<?php echo $this->url(array(), 'bizprofile_auth_forgot'); ?>" class="t_a_ui_helper_arrow_right"><?php echo $this->translator('auth_forgot_password'); ?></a>
    </div>

    <div class="clearfix">
        <label>&nbsp;</label>
        <button type="submit" class="t_a_right"><span><?php echo $this->translator('auth_login_submit_button'); ?></span></button>
    </div>

</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
    /**
    * Validate form
    */
    $('#loginForm').validate({
        rules: {
            username: {
                required: true
            },
            password: {
                required: true
            }
        },
        messages: {
            username: {
                required: "<?php echo $this->translator('auth_login_user_name_required'); ?>"
            },
            password: {
                required: "<?php echo $this->translator('auth_login_password_required'); ?>"
            }
        }
    });
});
</script>
